<template>
	<view class="course-media">
		<view class="course-media-item" v-for="item in courseMedias" :key="item.id"
			:class="{ 'active': item.id == curMediaId }" @click.stop="handleItemClick(item)">
			<text class="order">第{{ item.orderBy }}集</text>
			<text class="media-title">{{ item.title }}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'VideoChapters',
		data() {
			return {

			}
		},
		props: {
			courseMedias: {
				type: Array,
				default: [],
			},
			curMediaId: Number
		},
		computed: {

		},
		methods: {
			// 处理章节被点击
			handleItemClick(item) {
				this.$emit('chaptersClick', item);
			}
		},
	}
</script>

<style lang="scss" scoped>
	@import 'VideoChapters.scss';
</style>